package pattern.memento;

import com.alibaba.fastjson.JSONObject;

public class Test {

	public static void main(String args[]) {
		Original original = new Original();
		original.setCode("code");
		original.setName("name");
		original.setValue("value");
		
		Storage storage = new Storage();
		storage.setMemento(original.createMemento());
		
		original.setCode("coded2");
		original.setName("name23");
		System.out.println(JSONObject.toJSON(original));
		
		original.restorMemento(storage.getMemento());
		System.out.println(JSONObject.toJSON(original));
		
	}
}
